﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CsharpHttpHelper;

namespace Download
{
    class Basic
    {
        HttpHelper hh = new HttpHelper();
        HttpItem hi = new HttpItem();
        HttpResult hr = new HttpResult();

        #region M3U8相关
        public async Task<string> getM3U8File(HttpItem _hi)
        {
            clearHTTP();
            var ret = await Task.Run(() =>
            {
                hr = hh.GetHtml(_hi);
                if (hr.Html.IndexOf("#EXTINF:") > -1)
                {
                    return hr.Html;
                }
                else
                {
                    return "获取M3U8失败";
                }
            });
            return ret;
        }

        #endregion
        private void clearHTTP()
        {
            hh = new HttpHelper();
            hi = new HttpItem();
            hr = new HttpResult();
        }
    }
}
